/**
 * @name   rt_sem_init
 *
 * @brief  Initialize a static semaphore object.
 *
 * @note   For the static semaphore object, its memory space is allocated by the compiler during compiling and placed on the read-write
 *         data segment or on the uninitialized data segment.
 *         By contrast, the rt_sem_create() function will allocate memory space automatically and initialize the semaphore.
 *
 * @param  sem is a pointer to the semaphore to initialize. It is assumed that storage for the semaphore will be allocated in your application.
 *
 * @param  name is a pointer to the name you would like to give.
 *
 * @param  value is the initial value for the semaphore.
 *         If it is used to share resources, you should initialize the value as the number of available resources.
 *         If it is used to signal the occurrence of an event, you should initialize the value as 0.
 *
 * @param  flag is the semaphore flag, which determines the queuing way of how multiple threads wait when the semaphore is not available.
 *         the semaphore flag can be ONE of the following values:
 *
 *             RT_IPC_FLAG_PRIO          The pending threads will queue in order of priority.
 *
 *             RT_IPC_FLAG_FIFO          The pending threads will queue in the first-in-first-out method
 *                                       (also known as first-come-first-served (FCFS) scheduling strategy).
 *
 *
 *             Note: RT_IPC_FLAG_FIFO is a non-real-time scheduling mode. It is strongly recommended to use RT_IPC_FLAG_PRIO
 *             to ensure the thread is real-time UNLESS your applications concern about the first-in-first-out principle,
 *             and you clearly understand that all threads involved in this semaphore will become non-real-time threads.
 *
 * @return  Return the operation status. When the return value is RT_EOK, the initialization is successful. If the return value is any other values,
 *          it will represent a failed initialization.
 *
 * @warning This function can ONLY be called from threads.
 */
rt_err_t rt_sem_init(rt_sem_t    sem,
                     const char *name,
                     rt_uint32_t value,
                     rt_uint8_t  flag)
{
    RT_ASSERT(sem != RT_NULL);
    RT_ASSERT(value < 0x10000U);


    .......
}
